package com.heyqing.topic.IsUgly_0263;

import java.util.HashSet;
import java.util.Set;

/**
 * ClassName:IsUgly
 * Package:com.heyqing.topic.IsUgly_0263
 * Description:
 *
 * @Date:2024/9/25
 * @Author:Heyqing
 */
public class IsUgly {
    public boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        }
        int[] factors = {2, 3, 5};
        for (int factor : factors) {
            while (n % factor == 0) {
                n /= factor;
            }
        }
        return n == 1;
    }

}
